package cn.msi.customer.action;

import cn.common.action.GeneralAction;
import cn.msi.customer.domain.User;
import cn.msi.customer.service.UserService;

/**
 * 用户管理请求业务处理类
 * 
 * @author Administrator
 * 
 */
public class UserAction extends GeneralAction {

	private static final long serialVersionUID = 1248461409076587116L;

	private User user = new User();

	private UserService userService;

	/**
	 * 用户登陆
	 * 
	 * @throws Exception
	 */
	public void login() throws Exception {
		String msg = userService.login(user);
		out(msg);
	}

	/**
	 * 用户登出
	 * 
	 * @throws Exception
	 */
	public void loginOut() throws Exception {
		String msg = userService.loginOut(user);
		out(msg);
	}

	/**
	 * 系统界面
	 * 
	 * @return
	 * @throws Exception
	 */
	public String forward() throws Exception {
		userService.handlerUser();
		return SUCCESS;
	}

	/**
	 * 客户被调研客户的用户列表界面
	 * 
	 * @return
	 * @throws Exception
	 */
	public void searchUserList() throws Exception {
		page(user);
		String json = userService.searchUserByCust(user);
		out(json);
	}

	/**
	 * 查找用户账号
	 * 
	 * @return
	 * @throws Exception
	 */
	public String findUser() throws Exception {
		user = userService.findUser(user);
		return SUCCESS;
	}

	/**
	 * 编辑用户账号
	 * 
	 * @throws Exception
	 */
	public void eidtUser() throws Exception {
		userService.editUser(user);
	}

	/**
	 * 删除用户账号
	 * 
	 * @throws Exception
	 */
	public void deleteUser() throws Exception {
		userService.deleteUser(user);
	}

	/**
	 * 查询用户账户
	 * 
	 * @throws Exception
	 */
	public void userSearchList() throws Exception {
		page(user);
		String json = userService.userSearchList(user);
		out(json);
	}

	/**
	 * 用户查找
	 * 
	 * @return
	 * @throws Exception
	 */
	public String userFind() throws Exception {
		user = userService.findUser(user);
		return SUCCESS;
	}

	/**
	 * 保存用户账户
	 * 
	 * @throws Exception
	 */
	public void userSave() throws Exception {
		userService.userSave(user);
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public void setUserService(UserService userService) {
		this.userService = userService;
	}

}
